package com.wll.design.观察者.springboot.event;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @ClassName: EventListener.java
 * @author: wanglulu
 * @version: 1.0.0
 * @Description: TODO
 * @createTime: 2021/11/25 15:59
 */
@Slf4j
@Component
public class EventListener implements ApplicationListener<CustomEvent> {

    @Override
    public void onApplicationEvent(CustomEvent event) {
        //这里也可以监听所有事件 使用 ApplicationEvent 类即可
        //这里仅仅监听自定义事件 CustomEvent
        log.info("ApplicationListener方式监听事件：{}", event.getMessageEntity().toString());
    }


}
